const logoImg=[
  "https://revo.zongheng.com/comm/2024/98ffe0d3.png",
  "https://revo.zongheng.com/comm/2024/87d13bef.png",
]
const topul1=["首页", "纵横女生网", "脑洞星球", "下载APP"]
const topul2=["首页", "分类", "排行", "书库", "完本", "下载APP"]
const ul5=document.querySelector('.classify')
const navbar=document.querySelector('.toplist-box')
const scrollToTopBtn=document.querySelector('.returnTop')
const logoimg=document.querySelector('.logo-box')
const p=document.querySelector('.login')
const p2=document.querySelectorAll('.three p')
const imgs1=['https://revo.zongheng.com/comm/2024/5ac89d35.png',
  'https://revo.zongheng.com/comm/2024/d16def15.png',
  'https://revo.zongheng.com/comm/2024/21f9e763.png'
]
const imgs2=['https://revo.zongheng.com/comm/2024/4362970d.png',
  'https://revo.zongheng.com/comm/2024/4362970d.png',
  'https://revo.zongheng.com/comm/2024/9f32521d.png'
]
const imgthree=document.querySelectorAll('.three img')
console.log(imgthree)
window.addEventListener('scroll',function(){
  const scrollPosition = window.scrollY || document.documentElement.scrollTop
  if (scrollPosition > 10) {
    renderMenu(topul2)
    navbar.style.background='#fff'
    const lis=document.querySelectorAll('.classify li')
      lis.forEach(item=>{
        item.style.color='#333'
      })
    imgthree[0].setAttribute('src',imgs2[0])
    imgthree[1].setAttribute('src',imgs2[1])
    imgthree[2].setAttribute('src',imgs2[2])
    p2.forEach(item=>{
      item.style.color='#333'
      
    })
    logoimg.style.backgroundImage='url("https://revo.zongheng.com/comm/2024/87d13bef.png")'  
    p.style.color='#333'
  } else {
    renderMenu(topul1)
    navbar.style.background='transparent'
    const lis=document.querySelectorAll('.classify li')
      lis.forEach(item=>{
        item.style.color='#fff'
      
      })
      logoimg.style.backgroundImage='url("https://revo.zongheng.com/comm/2024/98ffe0d3.png")'
      p.style.color='#fff'
      imgthree[0].setAttribute('src',imgs1[0])
      imgthree[1].setAttribute('src',imgs1[1])
      imgthree[2].setAttribute('src',imgs1[2])
      p2.forEach(item=>{
      item.style.color='#fff'
    })
  }
})
function renderMenu(menuItems) {
  ul5.innerHTML = ''
  menuItems.forEach(item => {
    const li = document.createElement('li')
   if (item === "脑洞星球") {
      li.innerHTML = `<a href="naodongindex.html">${item}</a>`;
    } else if (item === "纵横女生网") {
      li.innerHTML = `<a href="first.html">${item}</a>`;
    } else if (item === "分类") {
      li.innerHTML = `<a style="color:#222" href="indexSort.html">${item}</a>`;
    }else{
      // 其他菜单项保持文本形式（如果需要也可以添加链接）
      li.textContent = item;
    }
    ul5.appendChild(li)
  });
}
renderMenu(topul1)
scrollToTopBtn.addEventListener('click', function() {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            })
        })
const sort=["玄幻奇幻", "都市", "武侠仙侠", "奇闻异事", "现实题材", "科幻", "历史", "其他分类"]
const zhuanqu=["作者专区", "签约政策", "投稿指南", "完本专区", "漫画专区", "征文专区"]
const ul1=document.querySelector('.center1')
sort.forEach((item,index)=>{
    ul1.innerHTML+=`
        <li onclick="jump()" data-index=${index}>${item}</li>
    `
})
const ul2=document.querySelector('.right1')
zhuanqu.forEach(item=>{
    ul2.innerHTML+=`
        <li>${item}</li>
    `
})
const section=[
  {
    "text": "纵横月票改版试运营",
    "date": "08-22"
  },
  {
    "text": "超爽黑啤《都市古仙医2：大医镇世》新书上架",
    "date": "08-11"
  },
  {
    "text": "月票榜7月季军《人在末世，我能联通现实》",
    "date": "08-11"
  },
  {
    "text": "月票榜7月亚军《齐天》",
    "date": "08-11"
  },
  {
    "text": "月票榜7月冠军《人间有剑》",
    "date": "08-11"
  },
  {
    "text": "女频主题征文一 雄竞火葬场",
    "date": "07-14"
  }
]
const ul3=document.querySelector('.section')
section.forEach(item=>{
    ul3.innerHTML+=`
        <li>
            <p class="text">${item.text}</p>
            <p class="time">${item.date}</p>
        </li>
    `
})
const book1=[
  {
  "image": "https://static.zongheng.com/upload/cover/78/5d/785ddeed3d46b1f57c5494a5478133b91733716855236.jpeg",
  "title": "从县委书记到权力巅峰",
  "description": "他凭借过人的能力抽丝拨茧，走出一条不同官道......",
  "author": "任语丁",
  "sort":"都市"
  },
  {
  "image": "https://static.zongheng.com/upload/cover/de/de/dedeaf9e9c9c0a2ce9c169220f69d6a71753346503145.jpeg",
  "title": "逆天邪神",
  "description": " 承邪神之血，修逆天之力，一代邪神，君临天下！",
  "author": "火星引力",
  "sort":"玄幻奇幻"
  },
  {
  "image": "https://static.zongheng.com/upload/cover/25/c7/25c7abeba5975062b95009b49c9200f11754963134664.jpeg",
  "title": "逆流年代：从1970开始种田养家",
  "description": "别人都不看好他，偏偏他最争气......",
  "author": "慎思量",
  "sort":"都市"
  },
  {
  "image": "https://static.zongheng.com/upload/cover/6d/e8/6de8637db8ba4c0b5d9bc89710307e8f1753091156107.jpeg",
  "title": "灰烬领主",
  "description": " 并不是所有黑暗的地方，都需要光......",
  "author": "我爱小豆",
  "sort":"玄幻奇幻"
  },
  {
  "image": "https://static.zongheng.com/upload/cover/41/f2/41f2de0294cb8df19c632f55f85e623d1728723307782.jpeg",
  "title": "重生78，开局被女知青退婚",
  "description": "当李向南真的走上人生巅峰，女知青已然悔不当初！",
  "author": "风里掌灯见惊泓",
  "sort":"都市"
  },
  {
  "image": "https://static.zongheng.com/upload/cover/b5/c6/b5c6f681ee2da73337407dd96d7b688d1751616880550.jpeg",
  "title": "封疆悍卒",
  "description": "第二天，他决定弃文从武，加入边军……",
  "author": "宿言辰",
  "sort":"历史"
  }
]
const ul4=document.querySelector('.center2')
book1.forEach(item=>{
  ul4.innerHTML+=`
      <li>
          <div class="leftBig">
              <div class="ImgBox">
                  <img class="lbc" src="${item.image}" alt=""  onclick="ju()">
              </div>
          </div>
          <div class="rightTxt">
              <p class="lbt"  onclick="ju()">${item.title}</p>
              <p class="lbi">${item.description}</p>
              <p class="lbb"><span  onclick="diji()">${item.author}</span> · <span>${item.sort}</span></p>
          </div>
      </li>
  `
})
const bookData = [
  {
    category: "奇幻 · 玄幻",
    image: "https://revo.zongheng.com/www/2024/images/030b165.png", 
    books: [
      { title: "剑武至尊" ,
        sort:"[玄幻奇幻]"
      },
      { title: "灰烬领主",
        sort:"[玄幻奇幻]"
       },
      { title: "天道珠" ,
        sort:"[玄幻奇幻]"
      },
      { title: "逼我剜骨断亲，我选择成为..." ,
        sort:"[玄幻奇幻]"
      }
    ]
  },
  {
    category: "历史 · 悬疑",
    image: "https://revo.zongheng.com/www/2024/images/a27bee9.png", 
    books: [
      { title: "荡宋",
        sort:"[历史]"
      },
      { title: "侯门第一纳绣",
        sort:"[历史]"
      },
      { title: "大唐：开局带太子勾栏听曲",
        sort:"[历史]"
      },
      { title: "北军悍卒",
        sort:"[历史]"
      },
      { title: "江山风华录：开局从美驴开始",
        sort:"[历史]"
      }
    ]
  },
  {
    category: "武侠 · 仙侠",
    image: "https://revo.zongheng.com/www/2024/images/5fc7462.png", 
    books: [
      { title: "剑来与雪中：剑心刀魂",
        sort:"[武侠仙侠]"
      },
      { title: "老六修仙：我靠捡修为横扫...",
        sort:"[武侠仙侠]"
      },
      { title: "忘忧剑诀",
        sort:"[武侠仙侠]"
      },
      { title: "家族修仙，我为镇族神鼎",
        sort:"[武侠仙侠]"
      },
      { title: "苍莽仙途",
        sort:"[武侠仙侠]"
      }
    ]
  },
  {
    category: "科幻 · 游戏",
    image: "https://revo.zongheng.com/www/2024/images/0d1772e.png", 
    books: [
      { title: "决战星辰",
        sort:"[科幻]"
      },
      { title: "未世正能量",
        sort:"[科幻]"
      },
      { title: "末日：开局变丧尸，我靠电粮打...",
        sort:"[科幻]"
      },
      { title: "末日无限进化",
        sort:"[科幻]"
      },
      { title: "末世：物资无限叠加，高冷校花...",
        sort:"[科幻]"
      }
    ]
  },
  {
    category: "都市 · 竞技",
    image: "https://revo.zongheng.com/www/2024/images/d161f12.png", 
    books: [
      { title: "吃蘑菇后，我成了绝世古仙医",
        sort:"[都市]"
      },
      { title: "让你下山娶妻，不是让你震惊世...",
        sort:"[都市]"
      },
      { title: "高武：开局俘获校花，我靠装杯...",
        sort:"[都市]"
      },
      { title: "重生1991：从发财开始逆袭",
        sort:"[都市]"
      },
      { title: "从女子监狱走出后，全球震动",
        sort:"[都市]"
      }
    ]
  },
  {
    category: "次元 · 同人",
    image: "https://revo.zongheng.com/www/2024/images/2da5dbb.png", 
    books: [
      { title: "亮剑双穿：杀敌换物资，步枪...",
        sort:"[N次元]"
       },
      { title: "开局卧底和联胜",
        sort:"[N次元]"
      },
      { title: "北京世子？我让徐凤年当去",
        sort:"[N次元]"
      },
      { title: "贱宗",
        sort:"[N次元]"
      },
      { title: "我在动漫世界苟到成神",
        sort:"[N次元]"
      }
    ]
  }
]
const ul6=document.querySelector('.r3u ')
bookData.forEach(item=>{
  let lis=''
  item.books.forEach(items=>{
    lis+=`
      <li>
          <p class="leftp">${items.sort}</p>
          <p class="rightp"  onclick="ju()" >${items.title}</p>
      </li>
    `
  })
  ul6.innerHTML+=`
        <li>
            <div class="upimg" style="background-image: url(${item.image});">
                <p>${item.category}</p>
            </div>
            <div class="downtxt">
                <ul>
                    ${lis}
                </ul>
            </div>
        </li>
  `
})
const bookData1 = [
  {
    category: "古代言情",
    image: "https://revo.zongheng.com/www/2024/images/6561cb3.png", 
    books: [
      { 
        title: "凤女无双",
        sort: "古代言情",
        description: "她尊敬父兄，良善待人，对于双腿残疾的未婚夫...",
        author: "恋玉姑娘·",
        cover:  "https://static.zongheng.com/upload/cover/50/4e/504e6c098bf08fd29e8042427e01240c1732069830727.jpeg"
      },
      { 
        title: "嚣张鬼医妃，邪王请乖乖",
        sort: "[古代言情]"
      },
      { 
        title: "农女神田：腹黑将军哪里跑",
        sort: "[古代言情]"
      },
      { 
        title: "妖颜女圣师",
        sort: "[古代言情]"
      },
      { 
        title: "盛宠无双：医妃权倾天下",
        sort: "[古代言情]"
      },
      { 
        title: "重生之宠妾要上天",
        sort: "[古代言情]"
      },
      { 
        title: "庶女无敌：挡我者跪",
        sort: "[古代言情]"
      }
    ]
  },
  {
    category: "都市言情",
    image: "https://revo.zongheng.com/www/2024/images/02b7024.png", 
    books: [
      { 
        title: "出殡日你没时间，我重生崛起你发疯",
        sort: "现代言情",
        description: "六年婚姻，只有夜里的狂欢，没有白日的温情。",
        author: "一尾金鱼",
        cover: "https://static.zongheng.com/upload/cover/dd/aa/ddaa3ee90ba49c17db93bd01698034681750230939815.jpeg" 
      },
      { 
        title: "重生之择命天女",
        sort: "[现代言情]"
      },
      { 
        title: "谋爱成婚：总裁大人饶了我",
        sort: "[现代言情]"
      },
      { 
        title: "极品萌宝：霸道爹地护妻狂",
        sort: "[现代言情]"
      },
      { 
        title: "蚀骨宠婚：陆少，别贪睡",
        sort: "[现代言情]"
      },
      { 
        title: "甜妻密爱：总裁大人别宠我",
        sort: "[现代言情]"
      },
      { 
        title: "重生蜜爱：傅少宠妻请低调",
        sort: "[现代言情]"
      }
    ]
  },
  {
    category: "幻想时空",
    image: "https://revo.zongheng.com/www/2024/images/e4aad56.png", 
    books: [
      { 
        title: "紫眸逆天：废柴大小姐",
        sort: "幻想言情",
        description: "无忧无虑的修仙生活被一次意外打破，佩剑染血...",
        author: "云霄笙",
        cover: "https://static.zongheng.com/upload/cover/67/e8/67e8a7312f2d870fc1ff60341cbaa4271718365177384.jpeg" 
      },
      { 
        title: "邪王，请放过",
        sort: "[幻想言情]"
      },
      { 
        title: "称帝二字，老娘都说倦了",
        sort: "[幻想言情]"
      },
      { 
        title: "快穿之咸鱼宿主只想走剧情",
        sort: "[幻想言情]"
      },
      { 
        title: "倾世女帝",
        sort: "[幻想言情]"
      },
      { 
        title: "妃常难驯：魔帝要追妻",
        sort: "[幻想言情]"
      },
      { 
        title: "狐倩一世缘",
        sort: "[幻想言情]"
      }
    ]
  }
]
const ul7=document.querySelector('.r4u')
bookData1.forEach(item=>{
  let lis2=''
  item.books.forEach((items,index)=>{
    if(index==0){
      lis2+=`
         <li>
            <div class="img-box">
                <img src=${items.cover} alt=""  onclick="ju()">
            </div>
            <div class="left1word">
                <p class="lwt"  onclick="ju()">${items.title}</p>
                <p class="lwi">
                  ${items.description}
                </p>
                <p class="lws"  ><span   onclick="diji()">${items.author}</span> ·  <span>${items.sort}</span></p>
            </div>
        </li>
      `
    }else{
      lis2+=`
      <li>
          <p class="leftp">${items.sort}</p>
          <p class="rightp"  onclick="ju()">${items.title}</p>
      </li>
      `
    }
  })
  ul7.innerHTML+=`
    <li>
        <div class="upimg" style="background-image: url(${item.image});">
            <p>${item.category}</p>
        </div>
        <div class="downtxt1">
            <ul>
                ${lis2}
            </ul>
        </div>
    </li>
  `
})
const bookData2 = [
  {
    category: "玄幻·奇幻",
    image: "https://revo.zongheng.com/www/2024/images/fd5d59d.png",
    books: [
      {
        title: "典藏华夏：开局对话汉武帝",
        sort: "[玄幻奇幻]"
      },
      {
        title: "全民：地表最强，修真界头...",
        sort: "[玄幻奇幻]"
      },
      {
        title: "全民转职：我丧尸之主，开...",
        sort: "[玄幻奇幻]"
      },
      {
        title: "我，皇陵尸体，开局签到极...",
        sort: "[玄幻奇幻]"
      },
      {
        title: "造人就能变强，打造最强不...",
        sort: "[玄幻奇幻]"
      }
    ]
  },
  {
    category: "科幻·游戏",
    image: "https://revo.zongheng.com/www/2024/images/48ac5a9.png",
    books: [
      {
        title: "无限吞噬：从蛇进化成禁区兽皇",
        sort: "[科幻]"
      },
      {
        title: "方舟恐龙：只有我能疯狂进化",
        sort: "[游戏]"
      },
      {
        title: "末日剑神：开局觉醒神级天赋，...",
        sort: "[科幻]"
      },
      {
        title: "LOL：这选手醉酒比赛，全网笑疯",
        sort: "[游戏]"
      },
      {
        title: "全民：转职科学家，开局一颗沙...",
        sort: "[游戏]"
      }
    ]
  },
  {
    category: "都市·娱乐",
    image: "https://revo.zongheng.com/www/2024/images/9c8a455.png",
    books: [
      {
        title: "重生都市之神级选择",
        sort: "[都市]"
      },
      {
        title: "开局得未来光脑，靠科技制霸全球",
        sort: "[都市]"
      },
      {
        title: "全民修仙：我的功法能自动修炼",
        sort: "[都市]"
      },
      {
        title: "开局一万俯卧撑，秒杀宗师",
        sort: "[都市]"
      },
      {
        title: "说好的直播算命，你让水友疯狂...",
        sort: "[都市]"
      }
    ]
  },
  {
    category: "历史·悬疑",
    image: "https://revo.zongheng.com/www/2024/images/e4c77ac.png",
    books: [
      {
        title: "被厉鬼盯上后，我化身成魔",
        sort: "[奇闻异事]"
      },
      {
        title: "神秘复苏：诡异至宝",
        sort: "[奇闻异事]"
      },
      {
        title: "指点考古队，你还说不是盗...",
        sort: "[奇闻异事]"
      },
      {
        title: "三国：我马谡，开局秒杀张郃",
        sort: "[历史]"
      },
      {
        title: "三国：别人搞战争，我搞修真！",
        sort: "[历史]"
      }
    ]
  },
  {
    category: "仙侠·洪荒",
    image: "https://revo.zongheng.com/www/2024/images/9015688.png",
    books: [
      {
        title: "武道长生：从斩杀狗妖开始",
        sort: "[武侠仙侠]"
      },
      {
        title: "镇守锁妖塔三十年，出世无...",
        sort: "[武侠仙侠]"
      },
      {
        title: "长生风流从救赎良家开始",
        sort: "[武侠仙侠]"
      },
      {
        title: "烂片导演？我一个人养活娱...",
        sort: "[武侠仙侠]"
      },
      {
        title: "洪荒香火成神：开局截教大...",
        sort: "[武侠仙侠]"
      }
    ]
  },
  {
    category: "同人·竞技",
    image: "https://revo.zongheng.com/www/2024/images/fc92312.png",
    books: [
      {
        title: "精灵：叫你高考，你掏出个修...",
        sort: "[N次元]"
      },
      {
        title: "我六边形锋霸，大罗小罗C罗惊...",
        sort: "[体育]"
      },
      {
        title: "NBA：开局就射杀，终成NBA大...",
        sort: "[体育]"
      },
      {
        title: "天啊，我是一条龙!",
        sort: "[N次元]"
      },
      {
        title: "NBA：开局带领18年火箭闯入...",
        sort: "[体育]"
      }
    ]
  }
]
const ul8=document.querySelector('.r5u')
bookData2.forEach(item=>{
  let lis3=''
   item.books.forEach(items=>{
    lis3+=`
      <li>
          <p class="leftp">${items.sort}</p>
          <p class="rightp"  onclick="ju()">${items.title}</p>
      </li>
    `
  })
  ul8.innerHTML+=`
        <li>
            <div class="upimg" style="background-image: url(${item.image});">
                <p>${item.category}</p>
            </div>
            <div class="downtxt">
                <ul>
                    ${lis3}
                </ul>
            </div>
        </li>
  `
})